package thesis.prototype;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class AddNumberDialog extends Activity implements OnClickListener
{
	private EditText e_enternumber;
	private Button b_addtolist;
	
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.add_number);
	}
	
	public void setContentView(int layoutResID){
		super.setContentView(layoutResID);
		addButtonListeners();
	}
	
	public void addButtonListeners()
	{
		e_enternumber = (EditText) findViewById(R.id.organizem_enternumber);
		b_addtolist = (Button) findViewById(R.id.organizem_addtolist);
		
		if(b_addtolist != null) b_addtolist.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		if(v==b_addtolist)
		{
			Intent data = new Intent();
			data.putExtra("thesis.prototype.AddNumberDialog.NEW_CONTACT", e_enternumber.getText().toString());
			setResult(RESULT_OK, data);
			
			finish();
		}
	}
}
